<template>
    <div class="hign_index" ref="hignRef">
        <div class="item">
            <div class="label">语言</div>
            <div class="value">
                <div>
                    <app-button3 v-model="state.formData.hign.language.type" :options="state.map.languageType" />
                </div>
                <div style="margin-top: 8px;" v-if="state.formData.hign.language.type == 1">
                    <el-select v-model="state.formData.hign.language.languages" multiple collapse-tags
                        placeholder="选择语言" style="width: 90%">
                        <el-option v-for="item in state.map.languages" :key="item.value" :label="item.label"
                            :value="item.value" />
                    </el-select>
                </div>

            </div>
        </div>

        <div class="item">
            <div class="label">时区</div>
            <div class="value">
                <div>
                    <app-button3 v-model="state.formData.hign.timeZone.type" :options="state.map.timeZoneType" />
                </div>
                <div style="margin-top: 8px;" v-if="state.formData.hign.timeZone.type == 1">
                    <el-select v-model="state.formData.hign.timeZone.timeZone" placeholder="选择时区" style="width: 90%">
                        <el-option v-for="item in state.map.timeZones" :key="item.value" :label="item.label"
                            :value="item.value" />
                    </el-select>
                </div>

            </div>
        </div>

        <div class="item">
            <div class="label">地理位置</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.location.show" :options="state.map.locationShow" />
                <app-button3 v-if="state.formData.hign.location.show == 1" v-model="state.formData.hign.location.type"
                    :options="state.map.locationType" style="margin-top: 8px;" />
                <div class="conent_list"
                    v-if="state.formData.hign.location.show == 1 && state.formData.hign.location.type == 1">
                    <div class="content_item">
                        <div class="content_label">经度</div>
                        <div class="content_value">
                            <el-input-number controls-position="right" v-model="state.formData.hign.location.longitude"
                                style="width: 100%" placeholder="经度" />
                        </div>
                    </div>
                    <div class="content_item">
                        <div class="content_label">纬度</div>
                        <div class="content_value">
                            <el-input-number controls-position="right" v-model="state.formData.hign.location.latitude"
                                style="width: 100%" placeholder="纬度" />
                        </div>
                    </div>
                    <div class="content_item">
                        <div class="content_label">精度(米)</div>
                        <div class="content_value">
                            <el-input-number controls-position="right" v-model="state.formData.hign.location.accuracy"
                                style="width: 100%" placeholder="精度" />
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="item">
            <div class="label">分辨率</div>
            <div class="value">
                <el-select v-model="state.formData.hign.resolution.type" placeholder="选择服务商" style="width: 90%">
                    <el-option v-for="item in state.map.resolutions" :key="item.value" :label="item.label"
                        :value="item.value" />
                </el-select>

                <div class="flex" style="margin-top: 8px;" v-if="state.formData.hign.resolution.type == '2'">
                    <el-input-number controls-position="right" v-model="state.formData.hign.resolution.resolutionW"
                        style="width: 120" />
                    <div class="flex" style="margin: 0 8px;">x</div>
                    <el-input-number controls-position="right" v-model="state.formData.hign.resolution.resolutionH"
                        style="width: 120" />
                </div>
            </div>
        </div>

        <div class="item">
            <div class="label">字体列表</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.font.type" :options="state.map.fontsTypes" />
                <el-select v-model="state.formData.hign.font.font" v-if="state.formData.hign.font.type == 0" multiple
                    collapse-tags placeholder="选择字体" style="width: 90%;margin-top: 8px;">
                    <el-option v-for="item in state.map.fonts" :key="item.value" :label="item.label"
                        :value="item.value" />
                </el-select>

            </div>
        </div>

        <div class="item">
            <div class="label">字体指纹</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.fontprint" :options="state.map.fontprints" />
            </div>
        </div>

        <div class="item">
            <div class="label">WebRTC</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.webrtc" :options="state.map.webrtcs" />
            </div>
        </div>

        <div class="item" v-if="state.formData.hign.webrtc == 0 || state.formData.hign.webrtc == 2">
            <div class="label">内网IP</div>
            <div class="value">
                <el-input class="user_agent_input" v-model="state.formData.hign.emsIP" style="width: 90%"
                    placeholder="内网IP">
                    <template #append>
                        <img src="@/assets/home/random.png" style="width: 18px;height: 18px;cursor: pointer;" alt="">
                    </template>
                </el-input>
            </div>
        </div>

        <div class="item">
            <div class="label">Canvas</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.canvas" :options="state.map.fontprints" />
            </div>
        </div>

        <div class="item">
            <div class="label">WebGL图像</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.webgl" :options="state.map.fontprints" />
            </div>
        </div>

        <div class="item">
            <div class="label">WebGL Info</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.webglInfo.type" :options="state.map.webglInfos" />
                <div class="conent_list" v-if="state.formData.hign.webglInfo.type == 1">
                    <div class="content_item">
                        <div class="content_label" style="width: 100px;">WebGL厂商</div>
                        <div class="content_value">
                            <el-input v-model="state.formData.hign.webglInfo.firm" style="width: 100%"
                                placeholder="WebGL厂商" />
                        </div>
                    </div>
                    <div class="content_item">
                        <div class="content_label" style="width: 100px;">WebGL渲染</div>
                        <div class="content_value">
                            <el-input class="user_agent_input" v-model="state.formData.hign.webglInfo.rendering"
                                style="width: 100%" placeholder="WebGL渲染">
                                <template #append>
                                    <img src="@/assets/home/random.png"
                                        style="width: 18px;height: 18px;cursor: pointer;" alt="">
                                </template>
                            </el-input>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="item">
            <div class="label">WebGPU</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.webgpu" :options="state.map.webgpus" />
            </div>
        </div>

        <div class="item">
            <div class="label">AudioContext</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.audioContext" :options="state.map.fontprints" />
            </div>
        </div>

        <div class="item">
            <div class="label">SpeechVoices</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.speechVoices" :options="state.map.speechVoicess" />
            </div>
        </div>

        <div class="item">
            <div class="label">媒体设置</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.media" :options="state.map.fontprints" />
            </div>
        </div>

        <div class="item">
            <div class="label">硬件并发数</div>
            <div class="value">
                <el-select v-model="state.formData.hign.concurrency" placeholder="硬件并发数" style="width: 90%">
                    <el-option v-for="item in state.map.concurrencys" :key="item.value" :label="item.label"
                        :value="item.value" />
                </el-select>
            </div>
        </div>

        <div class="item">
            <div class="label">设备内存</div>
            <div class="value">
                <el-select v-model="state.formData.hign.memory" placeholder="硬件并发数" style="width: 90%">
                    <el-option v-for="item in state.map.memorys" :key="item.value" :label="item.label"
                        :value="item.value" />
                </el-select>
            </div>
        </div>

        <div class="item">
            <div class="label">Do not track</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.donottrack" :options="state.map.donottracks" />
            </div>
        </div>

        <div class="item">
            <div class="label">电池</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.battery" :options="state.map.batterys" />
            </div>
        </div>

        <div class="item">
            <div class="label">端口扫描保护</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.portProtect.type" :options="state.map.speechVoicess" />
                <el-input v-if="state.formData.hign.portProtect.type == 1"
                    v-model="state.formData.hign.portProtect.ports" :rows="3" type="textarea"
                    style="width: 90%;margin-top: 8px;" placeholder="允许被扫描的本地网络端口，用逗号隔开" />
            </div>
        </div>

        <div class="item">
            <div class="label">启动参数</div>
            <div class="value">
                <el-input v-model="state.formData.hign.startParams" :rows="5" type="textarea" style="width: 90%;"
                    placeholder="选填，支持 Chromium 原生启动参数。示例
--disable-notifications
--blink-settings=imagesEnabled=false" />
            </div>
        </div>

        <div class="item">
            <div class="label">Cookie同步</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.cookieSync" :options="state.map.cookieSyncs" />
            </div>
        </div>

        <div class="item">
            <div class="label">多开设置</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.openmore" :options="state.map.openmores" />
            </div>
        </div>

        <div class="item">
            <div class="label">网页通知</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.webNotice" :options="state.map.webNotices" />
            </div>
        </div>

        <div class="item">
            <div class="label">禁止加载图片</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.loadingImg" :options="state.map.openmores" />
            </div>
        </div>

        <div class="item" v-if="state.formData.hign.loadingImg == 1">
            <div class="label">图像最大尺寸</div>
            <div class="value flex">
                <el-input-number style="width: 180px;margin: 0 8px;" v-model="state.formData.hign.imgSize"
                    :min="0" controls-position="right" />
                <div>KB</div>
            </div>
        </div>

        <div class="item">
            <div class="label">禁止加载视频</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.loadingVide" :options="state.map.openmores" />
            </div>
        </div>

        <div class="item">
            <div class="label">禁止播放声音</div>
            <div class="value">
                <app-button3 v-model="state.formData.hign.loadingMusic" :options="state.map.openmores" />
            </div>
        </div>


    </div>
</template>

<script setup>
const { store, state } = inject('storejs')
const hignRef = ref(null)

onMounted(() => {

})
</script>

<style lang="scss" scoped>
.hign_index {
    width: 100%;
    padding: 8px 16px 0 16px;
}

.item {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;

    .label {
        height: 30px;
        padding-bottom: 8px;
        color: #4e5969;
        font-size: 14px;
    }

    .value {
        .text {
            margin-top: 8px;
            color: #00000073;
            font-size: 14px;
        }

        .text2 {
            margin-top: 8px;
            color: #00000073;
            font-size: 12px;
        }

    }

}

.between {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;

    img {
        width: 18px;
        height: 18px;
        margin-right: 8px;
    }
}

.flex {
    display: flex;
    align-items: center;
}

.column {
    display: flex;
    flex-direction: column;
}

.checkip_text {
    display: flex;
    flex-direction: column;
    margin-top: 8px;
    font-size: 14px;
}

.conent_list {
    display: flex;
    flex-direction: column;

    width: 90%;

    .content_item {
        display: flex;
        align-items: center;
        margin-top: 8px;

        .content_label {
            width: 60px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            margin-right: 16px;
            color: #1d2129;
            font-size: 14px;
        }

        .content_value {
            flex: 1;
        }
    }
}
</style>

<style>
.app-button2-active {
    border: 1px solid #3569fd !important;
    color: #3569fd !important;
}


.user_agent_input .el-input-group__append {
    background-color: #fff;
}
</style>